package com.cssw.fyzb.core.dao.user;

import com.cssw.fyzb.core.model.dodb.*;
import com.ydn.dbframe.plugin.activerecord.Page;
import com.ydn.dbframe.plugin.activerecord.Record;

import java.util.List;
import java.util.Map;

/**
 * @author Feng Chen
 */
public interface UserDao {

    Long save(Long supUserId, String mobile, String loginPwd, String tradePwd, Integer floor, String avatar, String nickName);

    Long save(Long supUserId, String mobile, String loginPwd, String tradePwd, Integer floor, String userName, String nickName, String province, String city, String sex, String avatar);

    void update(Long userId, String userame, String idCard, String province, String city, String district);

    void updateFaceAuth(User user, String status);

    User getByMobile(String mobile, String pwd);

    User getByTradePwd(Long userId, String tradePwd);

    User getByMobile(String mobile);

    User getById(Long userId);

    void updateUserLevel(Long userId, Integer level);

    void updateTeamLevel(Long userId, Integer level);

    void updateImsi(Long userId, String imsi);

    void updateAvatar(Long userId, String avatar);

    void updateUserName(Long userId, String userName);

    void updateMobile(Long userId, String mobile);

    void updateProvince(Long userId, String province);

    void updateCity(Long userId, String city);

    void updateNickName(Long userId, String nickname);

    void updateSex(Long userId, String nickname);

    void updateBirthday(Long userId, String nickname);

    void updateSign(Long userId, String nickname);

    void updateLoginPwd(Long userId, String loginPwd);

    void updateTradePwd(Long userId, String tradePwd);

    int getUserRatioById(Long userId);

    long getProvinceUserCount(String province);

    long getCityUserCount(String city);

    Integer countUserBySupUserId(Long supUserId);

    Integer countVDirectSuberBySupId(Long supUserId);

    long getDistrictUserCount(String district);

    Page<Record> listUserDirectVitality(Long userId, int page, int limit);

    Page<User> listUserDirectFriendByCond(Map param, int page, int limit);

    String getUserLevelById(Long userId);

    User getByImsi(String imsi);

    User getByTradeImsi(String tradeImsi);


    Long saveFaceAuthLog(
            Long userId, String mobileNo, String userName, String idCard, String imageUrl,
            String status, String msg, String code, int costTime
    );

    Long saveUserAuthLog(
            Long userId, String userName, String idCard,
            String status, String msg, String code, int costTime
    );

    UserFaceLastFail queryFaceLastFail(Long userId);

    void saveFaceLastFail(Long userId, Integer respCode, String respMsg);

    List<User> listByIdCard(String idCard);

    Long saveTecentAuthFaceSend(
            String orderNo, String nonce, Long userId, String status,
            String respCode, String respMsg,
            String userName, String idNo
    );

    Long saveTecentAuthFaceQuery(
            String orderNo, String nonce, Long userId, String status,
            String respCode, String respMsg,
            String userName, String idNo
    );

    TecentAuthFaceSend getTecentAuthFaceSend(Long userId, String orderNo);

    Page<User> listUserChildByCond(Map param, int page, int limit);

    Page<User> pageUserFans(Map param, int page, int limit);

    Page<User> pageUserFollow(Map param, int page, int limit);

    Page<User> pageUserFriend(Map param, int page, int limit);

    void saveAuthInfo(Long userId, String userName, String province, String city, String district, String idCard);

    Page<User> searchUser(Map<String, Object> param, Integer pageNumber, Integer pageSize);

    User getAuthUserById(String idCard);

    void saveCmfToken(Long userId, String token);

    CmfUserToken getCmfTokenByUserId(Long userId);

    void updateCmfToken(CmfUserToken userToken);

    void saveCmfUserAuth(String userName, String msg, Boolean status, Integer userId);

    void updateCmfUser(CmfUser cmfUser);

    //查看总条数
    Integer countUser();

    User getIdCard(String idCard);

    //分页
    Page<User> list(Map param, int page, int limit);

    void updateStatus(Long userId, String status);

    Page<User> page(int pageNum, int pageSize);

    Page<User> pageVip(int pageNum, int pageSize);

    void updateAuthPay(Long userId);

    void saveAuthRecord(Long userId, String userName, String idCard, String province, String city, String district);

    void updateFace(Long userId, String face);

    void updateVip(Long userId, String vip, String userOpenVipTimeLong);

    void updatePendantUrl(Long userId, String pendantUrl);

    void updateFyNo(Long userId, Long fyNo, Integer fyNoNum);

    User getByFyNo(Long fyNo);
}
